package com.karst.essentials.chapter08
{
	import com.karst.essentials.chapter07.galaxyExample.GalaxyExample;
	
	import flash.display.Sprite;
	
	public class Chapter08View extends Sprite
	{
		public static const SECTION_LIST : Array = 
			["导入模型到pv3d 中", "导入带有动画的模型文件",
			"导入BLENDER模型到pv3d 中"
			 ] ;
		
		public function Chapter08View()
		{
			super();
		}
		
		
		public function showSection( $section : String = "" ) : void
		{
			while( numChildren )
				removeChildAt( 0 ) ;
			switch( $section )
			{
				case SECTION_LIST[0] :
					createExternalModelsNormalExample() ;
					break ;
				case SECTION_LIST[1] :
					createExternalModelsAnimatedExample() ;
					break ;
				case SECTION_LIST[2] :
					createExternalModelsBlenderExample() ;
					break ;
			}
		}

		private var externalModelsNormalExample : ExternalModelsNormalExample = null ;
		private function createExternalModelsNormalExample() : void
		{
			if( externalModelsNormalExample == null )
				externalModelsNormalExample = new ExternalModelsNormalExample() ;
			addChild( externalModelsNormalExample ) ;
		}

		private var externalModelsAnimatedExample : ExternalModelsAnimatedExample = null ;
		private function createExternalModelsAnimatedExample() : void
		{
			if( externalModelsAnimatedExample == null )
				externalModelsAnimatedExample = new ExternalModelsAnimatedExample() ;
			addChild( externalModelsAnimatedExample ) ;
		}

		private var externalModelsBlenderExample : ExternalModelsBlenderExample = null ;
		private function createExternalModelsBlenderExample() : void
		{
			if( externalModelsBlenderExample == null )
				externalModelsBlenderExample = new ExternalModelsBlenderExample() ;
			addChild( externalModelsBlenderExample ) ;
		}
	}
}